<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户--添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/components/layuiadmin/layui/src/css/layui.css">


    <script src="/manage/js/app.js"></script>
</head>
<style>
    .layui-form-item {
        margin-top: -0.6% !important;
    }


    .layui-form-item .layui-input-inline {
        width: 35%;
    !important;
    }

    input {
        border: none !important;
    }
</style>
<body>

<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">请求人:</label>
        <div class="layui-input-inline">
            <input type="text" id="fullName" name="fullName" lay-verify="required" autocomplete="off" class="layui-input">
        </div>

        <label class="layui-form-label">请求终端</label>
        <div class="layui-input-inline">
            <input type="text" id="type" name="type" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请求人Id </label>
        <div class="layui-input-inline">
            <input type="text" id="userId" name="userId" lay-verify="required" autocomplete="off" class="layui-input">
        </div>

        <label class="layui-form-label">请求来源</label>
        <div class="layui-input-inline">
            <input type="text" id="referer" name="referer" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类:</label>
        <div class="layui-input-inline">
            <input type="text" id="classDesc" name="classDesc" lay-verify="required" autocomplete="off" class="layui-input">
        </div>

        <label class="layui-form-label">用户主机名</label>
        <div class="layui-input-inline">
            <input type="text" id="host" name="host" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">方法:</label>
        <div class="layui-input-inline">
            <input id="methodDesc" name="methodDesc" lay-verify="required" autocomplete="off" class="layui-input">
        </div>

        <label class="layui-form-label">用户真实Ip</label>
        <div class="layui-input-inline">
            <input type="text" id="ip" name="ip" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">结果:</label>
        <div class="layui-input-inline" style="margin-top: 8px;margin-left: 8px">
            <span id="state"></span>
        </div>

        <label class="layui-form-label">服务器地址</label>
        <div class="layui-input-inline">
            <input type="text" id="serverName" name="serverName" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">

        <label class="layui-form-label">uri:</label>
        <div class="layui-input-inline">
            <input type="text" id="uri" name="uri" lay-verify="required" autocomplete="off" class="layui-input">
        </div>

        <label class="layui-form-label">服务器端口</label>
        <div class="layui-input-inline">
            <input type="text" id="port" name="port" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">

        <label class="layui-form-label">url:</label>
        <div class="layui-input-inline">
            <input type="text" id="url" name="url" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">包:</label>
        <div class="layui-input-inline">
            <input type="text" id="packageName" name="packageName" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类:</label>
        <div class="layui-input-inline">
            <input type="text" id="className" name="className" lay-verify="required" autocomplete="off" class="layui-input">
        </div>

    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请求方式:</label>
        <div class="layui-input-inline">
            <input type="text" id="method" name="method" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请求数据</label>
        <div class="layui-input-inline">
            <textarea type="text" style="height: 400px" id="requestData" name="requestData" lay-verify="required" autocomplete="off" class="layui-input"></textarea>
        </div>
        <label class="layui-form-label">响应数据</label>
        <div class="layui-input-inline">
            <textarea type="text" style="height: 400px" id="responseData" name="responseData" lay-verify="required" autocomplete="off" class="layui-input"></textarea>
        </div>
    </div>
</div>

<script>

    layui.use(['form'], function () {
        init();
    });

    function init() {
        <!-- 父页面的值,赋值到当前页 -->
        $('#fullName').val(parent.data.fullName);
        $('#userId').val(parent.data.userId);
        $('#type').val(Dict.convert(Enums.Base.AuthorityType, parent.data.type));
        $('#referer').val(parent.data.referer);
        $('#url').val(parent.data.url);
        $('#uri').val(parent.data.uri);
        $('#ip').val(parent.data.ip);
        $('#host').val(parent.data.host);
        $('#method').val(parent.data.method);
        $('#serverName').val(parent.data.serverName);
        $('#port').val(parent.data.port);
        $('#packageName').val(parent.data.packageName);
        $('#className').val(parent.data.className);
        $('#classDesc').val(parent.data.classDesc);
        $('#methodDesc').val(parent.data.methodDesc);
        $('#requestData').val(JSON.stringify(JSON.parse(parent.data.requestData), null, 2));
        $('#responseData').val(JSON.stringify(JSON.parse(parent.data.responseData), null, 2));

        var time = "   (业务耗时：" + parent.data.businessTime + "ms    总耗时：" + parent.data.executeTime + "ms)";
        $('#state').html(parent.data.state === 1 ?
            '<font color="green">成功</font>' + time :
            '<font color="red">失败</font>' + time);
    }

</script>
</body>
</html>
